home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
User's Choice Windows CD
/
User's Choice Windows CD (CMS Software)(1993).iso
/
win_q_t
/
trem.zip
/
CREATE.C
< prev
next >
Wrap
Text File
|
1991-05-11
|
4KB
|
124 lines
/************************************************************************
*
* Copyright (c) 1991 Microsoft Corporation. All Rights Reserved.
*
*-----------------------------------------------------------------------
*
* Project: Windows Terminal Example
*
* Module: create.c
*
* Author: Bryan A. Woodruff (baw)
*
*
* Remarks: Routines to create terminal information
*
* Revisions:
* 01.00.000 5/ 9/91 baw Wrote it
*
************************************************************************/
#include "terminal.h"
/************************************************************************
* LOCALHANDLE CreateTerminal( HWND hWnd )
*
* Description:
* Creates block, and initializes it.
*
* Comments:
* 5/ 9/91 baw Wrote it
*
************************************************************************/
LOCALHANDLE CreateTerminal( HWND hWnd )
{
HDC hDC ;
LOCALHANDLE hTermInfo ;
NPTERMINFO npTermInfo ;
TEXTMETRIC tm ;
if (NULL == (hTermInfo = LocalAlloc( LMEM_MOVEABLE, sizeof( TERMINFO ) )))
return ( NULL ) ;
if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
{
LocalFree( hTermInfo ) ;
return ( NULL ) ;
}
npTermInfo -> nCid = 0 ;
npTermInfo -> fConnected = FALSE ;
npTermInfo -> fLocalEcho = FALSE ;
npTermInfo -> fAutoWrap = TRUE ;
npTermInfo -> bPort = 1 ;
npTermInfo -> wBaudRate = 9600 ;
npTermInfo -> bByteSize = 8 ;
npTermInfo -> bFlowCtrl = FC_HARDWARE ;
npTermInfo -> bParity = NOPARITY ;
npTermInfo -> bStopBits = ONESTOPBIT ;
npTermInfo -> fXonXoff = FALSE ;
npTermInfo -> xSize = 0 ;
npTermInfo -> ySize = 0 ;
npTermInfo -> xScroll = 0 ;
npTermInfo -> yScroll = 0 ;
npTermInfo -> xOffset = 0 ;
npTermInfo -> yOffset = 0 ;
npTermInfo -> nColumn = 0 ;
npTermInfo -> nRow = 0 ;
_fmemset( npTermInfo -> abScreen, ' ', MAXROWS * MAXCOLS ) ;
npTermInfo -> hFont = CreateTerminalFont() ;
hDC = GetDC( hWnd ) ;
npTermInfo -> hDefaultFont = SelectObject( hDC, npTermInfo -> hFont ) ;
GetTextMetrics( hDC, &tm ) ;
ReleaseDC( hWnd, hDC ) ;
npTermInfo -> xChar = tm.tmAveCharWidth ;
npTermInfo -> yChar = tm.tmHeight + tm.tmExternalLeading ;
LocalUnlock( hTermInfo ) ;
return ( hTermInfo ) ;
} /* end of CreateTerminal() */
/************************************************************************
* HFONT CreateTerminalFont( VOID )
*
* Description:
*
*
* Comments:
*
************************************************************************/
HFONT CreateTerminalFont( VOID )
{
LOGFONT lf ;
lf.lfHeight = 12 ;
lf.lfWidth = 8 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = 0 ;
lf.lfItalic = 0 ;
lf.lfUnderline = 0 ;
lf.lfStrikeOut = 0 ;
lf.lfCharSet = OEM_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN ;
lf.lfFaceName[0] = NULL ;
return( CreateFontIndirect( &lf ) ) ;
} /* end of CreateTerminalFont() */
/************************************************************************
* End of File: create.c
************************************************************************/